KU-R3400 Card Reader communication driver

 

KU-R3400 Card Reader communication driver is the driver to communicate with carder reader of Kyushu Matsushita Electric Co., Ltd. in Japan.

 

1. Read Settings

 

<Figure 1> is read setting example of KU-R3400 Card Reader communication driver.

<Figure 1>  Read setting example of KU-R3400 Card Reader communication driver

Device part of  <Figure 1> input Com Port(COM1), Baud Rate(9600), Parity Bit(2), Data Bit(8), Stop Bit(1) respectively, according to controller.

In protocol option part, you can set 'reading period of status value'( mSec unit , default = 5000 mSec ).

Baud rate of KU-R3400 Card Reader can set 4800, 9600, 19200 BPS, but Parity Bit, Data Bit, Stop Bit are fixed to 2, 8, 1.

 

Note) KU-R3400 Card Reader communication driver made to read periodcally by setting time intervals.

Since the 'response time', you have to set 'Write TimeOut' more than 8000(mSec).

 KU-R3400 Card Reader communication driver only use one line read schedule. ( ignore when 2, ... line )

 

KU-R3400 Card Reader communication driver read schedule 

1) Station – don't care.

2) Read command – don't care.

3) Read atart address –  don't care.

4) Save start address for Communication Server – Saving start address of Communication Server.

start address + 0 : status value 1 of card reader, ( 0 ~ 6, refer to < Table 1> )

start address + 1 : status value 2 of card reader, ( 0 ~ 6, refer to < Table 1> )

start address + 2 : status value 1 of sensor, ( 0h ~ 0Fh, refer to < Table 2> ),

start address + 3 : status value 2 of sensor, ( 0h ~ 0Fh, refer to < Table 2> ),

start address + 4 : readed status of track 1,

start address + 5 : current value of track 1,

start address + 6 : readed status of track 2,

start address + 7 : current value of track 2,

start address + 8 : readed status of track 3,

start address + 9 : current value of track 3. 

5) Read Size – Fixed to 1.

 

Read schedule example)

READ,      ,      ,     0,    0,   1,

 

<Table 1> is value and contents for Status value 1, 2 of card reader.

<Table 2> is contents and meaning for each bit about Status value 1, 2 of sensor.

status value status value 1 of card reader status value 2 of card reader
0                 normal No Card Inserted
1 - Card Inserted(Front)
2 Power Up Error Card Inserted(Center)
3 Thermal Head High Temperature Card Inserted(Rear)
4 Jamming Error Waiting for Card Pulled Out(front)
5 Mechanical Error -
6 Hardware Error Cover Open
<Table 1> Value and contents for Status value 1, 2 of card reader
bit status value 1 of sensor status value 2 of sensor

Remarks

0              Sensor A -

Sensor : 1 = Card Exist,

0 = No Card Exist

Head : 1 = Down, 0 = Up

Cover : 1 = Open, 0 = Close

1 Sensor B Thermal Head Position
2 Sensor C Cover Position
3 Sensor D -
<Table 2> Contents and meaning for each bit about Status value 1, 2 of sensor

 KU-R3400 Card Reader communication driver store the same data in WORD, DWORD, FLOAT, STRING(only relating data) memory, but the data format are different.

If you click the icon  in protocol option part at <Figure 1>, you can see the dialog box such as <Figure 2>.

 

<Figure 2> Protocol option dialog box of KU-R3400 Card Reader communication driver
 
2. Writing settings

 You can read and write by using 'writing settings'. 

 

Digital Write

Digital write and analog write have the same setting parameters except output value. 

 

Analog Write 

Analog write setting parameters are as follows:

1)  PORT                   Port no. (0 ~ 255)

2)  STATION             whether to read at file the Write command.

 255 : read 'Write command and elements' data at 'work folder\SCAN\comm%03d.ini' file.(%03d : PORT number, refer to <Table 5> for input method of write command )

 0, ... : use 'Extra1' data for 'Write command and elements'. 

3)  ADDRESS          don't care.

4)  Extra1                  Write command and elements. ( refer to <Table 3 )

5) Extra2                   Data saving address for read command.( refer to <Table 3> )

 

<Table 3> is write command and contents of  KU-R3400 Card Reader communication driver.

<Table 4> is meaning and value for communication status value.

Write command Contents Type use of elements Data saving contents
start addr + 0 start addr + 1 ~
VS ROM Version Sensing read ¥ª communication status value for read/write command

refer to <Table 4 >
start addr + 1 : number of model, STRING = readed string,
start addr + 2 : number of version
ST Sensor Status Read start addr + 1 : 11 Sensor value for each bit
MR Mode Read start addr + 1 ~ 19 : 19 status value
CT Pass Count Read start addr + 1 : Pass Count value (double word)
RC Read Status Check start addr + 1 ~ 4 : error status value of track 1 ~ 4
DT Read Data Request ¡Û start addr + 1 : card number or value
PA Power Up Acknowledgment Simple Process ¥ª none
CL Waiting Condition Clear
PC Printer Buffer Clear
IC Image Data Copy Set ¡Û
RS Reset operation ¥ª
CI Card Insert/Read (Front)
CO Card Eject (Front)
RP Card Standby (Rear)
FP Card Standby (Front)
HC Head Cleaning
CR Roller Cleaning
RD Read Operation
WR Write Verify
WN Write Operation
VR Verify Operation
PR Print Operation after Erase ¡Û
PO Print and Eject Operation
PP Print without Erase
EP Erase without Erase ¥ª
MS Mode Setting data setting ¡Û
LD LED Brink Pattern Setting ¥ª
SG 7 Seg LED Array Setting
BZ Buzzer Buzz Pattern Set
CK Time Date Set/Read
WD Write Data Setting ¡Û
GJ Double Byte Character Entry
HJ Single Byte Character Entry
PD Print Data Setting
PI Print Image Data Setting
AS Erase/Print Area Set
IB Image Data Binary Transfer
<Table 3> Write command and contents of  KU-R3400 Card Reader communication driver

Value

Meaning

0

Transmission Framing Error

1

Transmission Overrun Error

2

Transmission Parity Error

3

Transmission Buffer Error

4

BCC Error

10

Power Up(Once Power Down) Error

11

Command Error(Command Undefined)

12

Command is Executing

13

Command cannot be Executed

14

Parameter Error

20

Card Inside(Command cannot Executed)

21

Waiting for Card to be Pulled out(Command cannot Executed)

22

Card Size Error

23

Card Inserting Error

25

No Card Inside(Command cannot Executed)

30

Card Jam Error

32

Thermal Head and Erase Head Up/Down Error(Mechanical Error)

33

Encoder Pulse Error(Hardware Error)

34

Cover Open Error

35

Hardware Error 1 (A/D Converter Error)

36

Hardware Error 2 (Sensor Error)

37

Hardware Error 3 (EEPROM Error)

38

Hardware Error 4 (DMA Error)

40

No Encoding Read or Verify Error

41

No Start Code

42

Parity Error

43

No End Code

44

LRC Error

45

Verify Error

46

No Read Data(Command Cannot Executed)

47

No Write Data(Command Cannot Executed)

48

Magnetic Data Code Error

50

No Printing Data(Command Cannot Executed)

51

Thermal High Temperature Error

52

Erase Head Error

53

Illegal Printing Character Error

54

Printing Area Over

90

normal

92

normal (No Operation)

94

normal (Thermal Head Low Temperature Warning)

96

normal (Read Error of any Track which is not Specified)

<Table 4> Meaning and value for communication status value

<Table 5> is input method for Write command and elements data.

Data

Contents

Remarks

\x??

input for control or special character,

?? : 00 ~ FF, hex-decimal

station = 255 : read 'Write command and elements' data at 'work folder\SCAN\comm%03d.ini'

(%03d : PORT number, after reading, delete the command file )

station = 0, ... : use 'Extra1' data for 'Write command and elements'

 

input at one line for 'Write command and elements' data.

(station = 255, input at 1st line of file )

\n

LF character ( equal to 0A or \x0A )

\r

CR character ( equal to 0D or \x0D )

\t

TAB character ( equal to 09 or \x09 )

0 ~ 9,

a ~ z, A ~ Z,

special character,...

data character

<Table 5> Input method for Write command and elements data

Write example 1)

PORT:0,  station:0, ADDRESS:0000, Extra1: DT,  Extra2 : 50

The setting parameter shown above is Data Request reading example. After reading, the readed value save at 50 ~ 51( 50 = communication status, 51 = card number or value ) WORD, FLOAT, DWORD memory.

If read error occurs, only save communication status data at 50 WORD, FLOAT, DWORD memory.

 

Note) Normally, DT command automatically execute by read routime. So, It does not need to write. ( write command )

 

Write example 2)

PORT:0,  station:0, ADDRESS:0000, Extra1: WD:3/123,  Extra2 : 100

The setting parameter shown above is 123 data setting example to 3 track. After writing, the setting result value save at 100( 90 =normal) WORD, FLOAT, DWORD memory.

 

Write example 3)

PORT:0,  station:0, ADDRESS:0000, Extra1: WR,  Extra2 : 110

The setting parameter shown above is Write Verify example for WD command. After writing, the setting result value save at 110( 90 =normal) WORD, FLOAT, DWORD memory.

 

Note) You have to write sequentially example 2) and example 3) for data write to track.  Namely, WD and WR command must write sequentially.

 

Write example 4)

PORT:0,  station:0, ADDRESS:0000, Extra1: PD:0/10/20/test character123,  Extra2 : 120

The setting parameter shown above is data setting example, the setting data = horizontal direction( 0 ), start X : 10,start Y : 20, printed string : ¡®test character123¡¯. After writing, the setting result value save at 120( 90 =normal) WORD, FLOAT, DWORD memory.

 

Write example 5)

PORT:0,  station:0, ADDRESS:0000, Extra1: PR,  Extra2 : 130

The setting parameter shown above is printing control(delete old printed data) example for previously setting string. After writing, the setting result value save at 130( 90 =normal) WORD, FLOAT, DWORD memory.

If you want to return the card after printing, use PO command instead PR.

 

Note) When you printing at equal X, Y position, the two string are duplicated.

In this case, use PC command (delete previous string ).

Also, you have to write sequentially example 4) and example 5) for printing the string(characters).  Namely, PD and PR( or PO, ... ) command must write sequentially.

 

Write example 6)

PORT:0,  station:0, ADDRESS:0000, Extra1: CO,  Extra2 : 140

The setting parameter shown above is Card Eject (Front) control example. After writing, the setting result value save at 140( 90 =normal) WORD, FLOAT, DWORD memory.

 

3. Connection of communication cable and main power

Connection of communication cable and main power are as follows.

 

Connection of communication cable

Please connect normal RS-232C(cross) communication cable to RS-232C connector such as <Figure 3>.

<Figure 4> Connection example of communication cable and main power to KU-R3400 Card Reader

 

 Connection of main power

Please connect 220V AC power to main power connector such as <Figure 3>.

<Figure 4> is appearance of  KU-R3400 Card Reader. 

<Figure 4> Appearance of  KU-R3400 Card Reader

 

4. Script example for KU-R3400 Card Reader

KU-R3400 Card Reader communication driver need script for writing data to track and printing.

script example using the KU-R3400 Card Reader : project example for KU-R3400

 

Script example for writing data

@sprintf(track_write_select,"MS:C%d",7);

$WRITE.TRACK_WRITE_INIT.extra1 = track_write_select;

$WRITE.TRACK_WRITE_INIT = 1;

 

for(i = 0; i < 100000; i = i+1)

{

             @TagCheckLoop();

             if($status != 0)

             {                                      // check, status value != 0

                          i = 100000;

             }

}

if ($status != 90)

{                                      //  check, status value != 90

             @MessageBox("Card track initialize failure.\nStatus value != 90", "Track initialize error", MB_OK);

             return;

}

 

@sprintf(buf1,"WD:1/%s",$WRITE.TRACK1_DATA_WRITE);

$WRITE.TRACK_DATA_SETTING.extra1 = buf1;

$WRITE.TRACK_DATA_SETTING = 1;

 

for(i = 0; i < 100000; i = i+1)

{

             @TagCheckLoop();

             if($status != 0)

             {                                      // check, status value != 0

                          i = 100000;

             }

}

if ($status != 90)

{                                      //  check, status value != 90

             @MessageBox("Card track write setting failure.\nStatus value != 90", "Track setting error", MB_OK);

             return;

}

 

$WRITE.TRACK_DATA_WRITE = 1;

 

 

 

 

Script example for printing

@sprintf(buf1,"PD:0/10/20/%s",$PRINT.MESSAGE_LINE1);

@sprintf(buf2,"PD:0/10/50/%s",$PRINT.MESSAGE_LINE2);

 

$PRINT.CARD_PRINT_BUFFER_CLEAR = 1;

 

for(i = 0; i < 100000; i = i+1)

{

             @TagCheckLoop();

             if($status != 0)

             {                                      // check, status value != 0

                          i = 100000;

             }

}

 

if ($status != 90)

{                                      //  check, status value != 90

             @MessageBox("Card printing data setting failure.\nStatus value != 90", "Setting error", MB_OK);

             return;

}

 

$PRINT.CARD_PRINT_DATA_SETTING.extra1 = buf1;

$PRINT.CARD_PRINT_DATA_SETTING = 1;

 

for(i = 0; i < 100000; i = i+1)

{

             @TagCheckLoop();

             if($status != 0)

             {                                      // check, status value != 0

                          i = 100000;

             }

}

 

if ($status != 90)

{                                      //  check, status value != 90

             @MessageBox("Card printing data setting failure.\nSetting ", "Setting error", MB_OK);

             return;

}

 

$PRINT.CARD_PRINT_DATA_SETTING.extra1 = buf2;

$PRINT.CARD_PRINT_DATA_SETTING = 1;